// 成绩表

const { STRING, INTEGER } = require("sequelize")
const sequelize = require("../sequelize")
const testpaper = require("./testpaper")

const achievement = sequelize.define("achievement", {
    name: {
        type: STRING,
        allowNull: false,
        comment: "交卷人姓名"
    },
    testnumber: {
        type: STRING,
        unique: true,
        comment: "交卷人考号"
    },
    choice: {
        type: STRING,
        comment: "选择题对应的题号及答案"
    },
    answer: {
        type: STRING,
        comment: "简答题对应的题号及答案"
    },
    conpletion: {
        type: STRING,
        comment: "填空题对应的题号及答案"
    },
    judge: {
        type: STRING,
        comment: "判断题对应的题号及答案"
    },
    title: {
        type: STRING,
        comment: "试卷标题"
    },
    handpapertime: {
        type: STRING,
        comment: "交卷时间"
    },
    testpaperId: {
        type: INTEGER,
        comment: "外键 对应试卷id"
    },
    updator: {
        type: STRING,
        comment: "修改者"
    },
    updated: {
        type: STRING,
        comment: "修改时间"
    },
}, { timestamps: false, underscored: true })

achievement.assoicate = () => {

    achievement.belongsTo(testpaper)
}

module.exports = achievement